
public class BitManipluation {
	
	
	public static int BitPractic(){
		int val = 5;
		val = 3 << val;
		
		System.out.println(val);
		return val;
	}
	
	public static boolean isUniqueChars(String str) {
	    int checker = 0;
	    for (int i = 0; i < str.length(); ++i) {
	    	/**
	    	 * a = 00000000000000000000000000000001
	    	 * b = 00000000000000000000000000000010
	    	 * c = 00000000000000000000000000000100
	    	 * .....
	    	 * 
	    	 * 'c' - 'a' = 2
	    	 * 
	    	 * 1 << 2 => 00000000000000000000000000000100
	    	 * 
	    	 */
	        int val = str.charAt(i) - 'a';//check the difference between 'a' and str.charAt(i)
	        if ((checker & (1 << val)) > 0) return false;//(1<<val) set the flag corresponding to the difference to 1
	        checker |= (1 << val);
	    }
	    return true;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		BitManipluation.BitPractic();
		System.out.println(BitManipluation.isUniqueChars("abccdef"));
	}

}
